import {
  ApplicationConfig,
  provideZoneChangeDetection,
  importProvidersFrom,
} from '@angular/core';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';
import { icons } from './icons-provider';
import { provideNzIcons } from 'ng-zorro-antd/icon';
import { zh_CN, provideNzI18n } from 'ng-zorro-antd/i18n';
import { registerLocaleData } from '@angular/common';
import zh from '@angular/common/locales/zh';
import { FormsModule } from '@angular/forms';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
import { provideHttpClient } from '@angular/common/http';
import { provideStore } from '@ngrx/store';
import { counterReducer } from './store/counter.reducer';
registerLocaleData(zh);

export const appConfig: ApplicationConfig = {
  providers: [
    // zone
    provideZoneChangeDetection({ eventCoalescing: true }),
    // router
    provideRouter(routes),
    // antd
    provideNzIcons(icons),
    provideNzI18n(zh_CN),
    // common
    importProvidersFrom(FormsModule),
    provideNoopAnimations(),
    provideHttpClient(),
    // store -- 必须给一个名字 (key), 用的时候 `store.select('count')`
    provideStore({ count: counterReducer })
  ],
};
